package com.am.mosl.cityandroid.util;

import com.am.mosl.cityandroid.bean.City;

import java.util.Comparator;

/**
 * Created by mosl on 14-7-12.
 */
public class ComparatorCity implements Comparator {

    @Override
    public int compare(Object o1, Object o2) {

        City c1=(City)o1;
        City c2=(City)o2;
        if(c1.getInitial().endsWith("热门城市")){
            return -1;
        }
        if(c2.getInitial().endsWith("热门城市")){
            return 1;
        }

        return c1.getInitial().compareTo(c2.getInitial());
    }


    public boolean containsChinese(String s){

        if (null == s || "".equals(s.trim())) return false;

        for (int i = 0; i < s.length(); i++) {

            if (isChinese(s.charAt(i))) return true;
        }

        return false;

    }

    public boolean isChinese(char a) {

        int v = (int)a;
        return (v >=19968 && v <= 171941);

    }



}
